package com.lynn.salary.web.action;

import java.util.List;

import com.lynn.salary.entity.Article;
import com.lynn.salary.pojo.FeedBack;
import com.lynn.salary.service.IArticleService;
import com.lynn.salary.service.IDailySignIn;
import com.lynn.salary.util.ObjectFactory;

public class HomeAction extends BaseAction {

	private IDailySignIn dailySignIn = (IDailySignIn) ObjectFactory
			.getBean("dailySignInService");
	
	
	private boolean showDailySignIn;

	private FeedBack feedBack;
	

	@Override
	public String execute() throws Exception {

//		showDailySignIn = !dailySignIn.isSignIn(loginUser.getLoginUser()
//				.getId());
		
		return super.execute();
	}
	
	public String signIn() throws Exception {

		feedBack = new FeedBack();
		feedBack.setStatusCode("200");
		if (!dailySignIn.isSignIn(loginUser.getLoginUser().getId())) {
			dailySignIn.signIn(loginUser.getLoginUser().getId());
			feedBack.setMessage("签到成功");
		} else {
			feedBack.setMessage("您今天签过到了!");
		}

		return "signInSuccess";
	}

	public boolean isShowDailySignIn() {
		return showDailySignIn;
	}

	public void setShowDailySignIn(boolean showDailySignIn) {
		this.showDailySignIn = showDailySignIn;
	}

	public FeedBack getFeedBack() {
		return feedBack;
	}

	public void setFeedBack(FeedBack feedBack) {
		this.feedBack = feedBack;
	}

	

}
